<!DOCTYPE html>
<html xmlns:th="http://www.w3.org/1999/xhtml">
<head th:include="include/css-head :: css-head">
</head>
<body>
<section class="content-header">
  <h1>
    <small></small>
  </h1>
  <ol class="breadcrumb">
    <li><a href="#"><i class="fa fa-dashboard"></i>设备管理</a></li>
    <li class="active">设备信息</li>
  </ol>
</section>

<!-- Main content -->
<section class="content">
	 <div class="box">
            <div class="box-header">
              <h3 class="box-title">用户管理</h3>
              <br><br>
              	<button th:if="${meid}==1" class="btn btn-success btn-sm" id="addData"><i class="fa fa-plus"></i> &nbsp;&nbsp;添加用户</button>
				<div class="btn-right">
					<label class="form-inline">用户名：<input type="text" class="form-control" id="username-search" th:value="${username}" autocomplete="off" /></label>
					<label class="form-inline">姓名：<input type="text" class="form-control" id="name-search" th:value="${name}"  autocomplete="off" /></label>
					<button class="btn btn-primary btn-sm" id="btn_search">查询</button>
				</div>
				<div class="clear"></div>
			</div>
            <div class="box-body">
              <table id="dataList" class="table table-bordered table-striped">
                <thead>
	                <tr>
	                  <th>序号</th>
						<th>用户名</th>
						<th>用户类型</th>
						<th>姓名</th>
					    <th>状态</th>
					    <!--<th>是否绑定微信</th>-->
	                    <th>操作</th>
	                </tr>
                </thead>
                <tbody>
				<tr th:each="one,stat:${result.data.list}">
					<td th:text="${stat.count}">序号</td>
					<td th:text="${one.username}">用户名</td>
					<td>
						<span th:if="${one.usertype==0}">超级管理员</span>
						<span th:if="${one.usertype==1}">管理员</span>
					</td>
					<td th:text="${one.name}">姓名</td>
					<td>
						<span th:if="${one.status==1}" style="color:green;">正常</span>
						<span th:if="${one.status==-1}" style="color:red;">禁用</span>
					</td>
					<!--<td>
						<span th:if="${one.is_bdwx==0}" style="color:green;">否</span>
						<span th:if="${one.is_bdwx==1}" style="color:red;">是</span>
					</td>-->
					<td >
						<span th:if="${one.status==1}">
							<span data-toggle="tooltip" data-placement="left" title="修改" class="btn btn-xs btn-info" th:onclick="'editUser('+${one.id}+')'"><i class="fa fa-edit"></i> 修改</span>
						</span>
						<span th:if="${one.status==1 and one.usertype != 0}">
							<span data-toggle="tooltip" data-placement="right" title="删除" class="btn btn-xs btn-danger" th:onclick="'delUser('+${one.id}+')'"><i class="fa fa-trash-o"></i> 禁用</span>
						</span>
						<span th:if="${one.status==-1}">
							<span data-toggle="tooltip" data-placement="right" title="启用" class="btn btn-xs btn-success" th:onclick="'reUser('+${one.id}+')'"><i class="fa fa-check"></i> 启用</span>
						</span>
					</td>
				</tr>
				<tr>
					<td height="30" colspan="7">
						<!--分页-->
						<div class="footer_style1">
							<span>共有<strong th:text="${result.data.recordsTotal}"></strong>条记录，当前第<strong><th:block th:text="${result.data.draw}"></th:block>/<th:block th:text="${result.data.totalpage}"></th:block></strong>页</span>
							<ul class="ul_style3">
								<li th:if="${result.data.draw eq 1}">
									<a>首页</a>
									<a>上一页</a>
								</li>
								<li th:if="${result.data.draw ne 1}">
									<a th:href="@{/user/list(pageNo=1)}">首页</a>
									<a th:href="@{/user/list(pageNo=${result.data.draw - 1})}">上一页</a>
								</li>
								<li th:if="${result.data.draw eq result.data.totalpage}">
									<a>下一页</a>
									<a>尾页</a>
								</li>
								<li th:if="${result.data.draw ne result.data.totalpage}">
									<a th:href="@{/user/list(pageNo=${result.data.draw + 1})}">下一页</a>
									<a th:href="@{/user/list(pageNo=${result.data.totalpage})}">尾页</a>
								</li>
							</ul>
						</div>

						<!--分页 end-->
					</td>
				</tr>
                </tbody>
                </table>
			</div>
	 </div>
	 </div>
</section>

<div class="modal fade" id="userModal" tabindex="-1" role="dialog"
	 aria-labelledby="myModalLabel" aria-hidden="true">
	<div class="modal-dialog">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal"
						aria-hidden="true">&times;</button>
				<h4 class="modal-title text-center" id="usermodelHead">添加用户</h4>
			</div>
			<div class="modal-body">
				<form class="form-horizontal"  role="form">
					<input type="hidden" name="url" value=""/>
					<input type="hidden" name="user_id" value=""/>
					<div class="form-group">
						<label for="username" class="col-sm-2 control-label">用户名</label>
						<div class="col-sm-10">
							<input type="text" class="form-control" name="username" value="" id="username" readonly="readonly">
						</div>
					</div>

					<div class="form-group">
						<label for="name" class="col-sm-2 control-label">姓名</label>
						<div class="col-sm-10">
							<input type="text" class="form-control" name="name" value="" id="name" placeholder="请输入姓名">
						</div>
					</div>
					<div class="form-group">
						<label for="name" class="col-sm-2 control-label">电话</label>
						<div class="col-sm-10">
							<input type="text" class="form-control" name="phone" value="" id="phone" placeholder="请输入手机号码">
						</div>
					</div>

					<div class="form-group">
						<label for="password" class="col-sm-2 control-label">用户密码</label>
						<div class="col-sm-10">
							<input type="password" class="form-control" name="password" value="" id="password" placeholder="请输入密码">
						</div>
					</div>
					<div class="form-group">
						<label for="usertype" class="col-sm-2 control-label">用户类别</label>
						<div class="col-sm-10">
							<select name="usertype" class="form-control" id="usertype" data-actions-box="true">
								<option value="1">管理员</option>
							</select>
						</div>
					</div>

				</form>
			</div>
			<div class="modal-footer">
				<button type="button" class="btn btn-primary" data-dismiss="modal">关闭</button>
				<button type="submit" class="btn btn-success"  id="imgSubmit" >确定</button>
			</div>
		</div>
	</div>
</div>
<script src="/static/bower_components/jquery/dist/jquery.min.js"></script>
<script src="/static/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
<script src="/static/bower_components/datatables.net/js/jquery.dataTables.min.js"></script>
<script src="/static/bower_components/datatables.net-bs/js/dataTables.bootstrap.min.js"></script>
<script src="/static/dist/js/adminlte.min.js"></script>
<script src="/static/js/path.js"></script>
<script src="/static/js/user.js"></script>
</body>
</html>
